Global Index
HTML5 JS API Index > ECMAScript Tutorials & Specs

Array

Extended by Elements

Array objects give special treatment to a certain class of property names. A property name P (in the form of a String value) is an array index if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 232−1. A property whose property name is an array index is also called an element.

Properties
int
length
The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.
Constructor
Array(optional any params...)
Array(int size)
Operations
static boolean
isArray(any arg)
The isArray function takes one argument arg, and returns the Boolean value true if the argument is an object whose class internal property is "Array"; otherwise it returns false.
string
concat(any items...)
When the concat method is called with zero or more arguments item1, item2, etc., it returns an array containing the array elements of the object followed by the array elements of each argument in order.
Array
every(Function callbackfn, optional any thisArg)
callbackfn should be a function that accepts three arguments and returns a value that is coercible to the Boolean value true or false. every calls callbackfn once for each element present in the array, in ascending order, until it finds one where callbackfn returns false.
Array
filter(Function callbackfn, optional any thisArg)
callbackfn should be a function that accepts three arguments and returns a value that is coercible to the Boolean value true or false. filter calls callbackfn once for each element in the array, in ascending order, and constructs a new array of all the values for which callbackfn returns true.
Array
forEach(Function callbackfn, optional any thisArg)
callbackfn should be a function that accepts three arguments. forEach calls callbackfn once for each element present in the array, in ascending order. callbackfn is called only for elements of the array which actually exist; it is not called for missing elements of the array.
int
indexOf(any searchElement, optional int fromIndex)
indexOf compares searchElement to the elements of the array, in ascending order, using the internal Strict Equality Comparison Algorithm (11.9.6), and if found at one or more positions, returns the index of the first such position; otherwise, -1 is returned.
string
join(string separator)
The elements of the array are converted to Strings, and these Strings are then concatenated, separated by occurrences of the separator. If no separator is provided, a single comma is used as the separator.
int
lastIndexOf(any searchElement, optional int fromIndex)
lastIndexOf compares searchElement to the elements of the array in descending order using the internal Strict Equality Comparison Algorithm (11.9.6), and if found at one or more positions, returns the index of the last such position; otherwise, -1 is returned.
Array
map(Function callbackfn, optional any thisArg)
callbackfn should be a function that accepts three arguments. map calls callbackfn once for each element in the array, in ascending order, and constructs a new Array from the results. callbackfn is called only for elements of the array which actually exist; it is not called for missing elements of the array.
any
pop()
The last element of the array is removed from the array and returned.
Array
push(any items...)
The arguments are appended to the end of the array, in the order in which they appear. The new length of the array is returned as the result of the call.
any
reduce(Function callbackfn, optional any initialValue)
callbackfn should be a function that takes four arguments. reduce calls the callback, as a function, once for each element present in the array, in ascending order.
any
reduceRight(Function callbackfn, optional any initialValue)
callbackfn should be a function that takes four arguments. reduceRight calls the callback, as a function, once for each element present in the array, in descending order.
Array
reverse()
The elements of the array are rearranged so as to reverse their order. The object is returned as the result of the call.
Array
shift()
The first element of the array is removed from the array and returned.
Array
slice(int start, int end)
The slice method takes two arguments, start and end, and returns an array containing the elements of the array from element start up to, but not including, element end (or through the end of the array if end is undefined). If start is negative, it is treated as length+start where length is the length of the array.
Array
some(Function callbackfn, optional any thisArg)
callbackfn should be a function that accepts three arguments and returns a value that is coercible to the Boolean value true or false. some calls callbackfn once for each element present in the array, in ascending order, until it finds one where callbackfn returns true.
Array
sort(Function compareFn)
The elements of this array are sorted. The sort is not necessarily stable (that is, elements that compare equal do not necessarily remain in their original order). If comparefn is not undefined, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y.
Array
splice(int start, int deleteCount, any items...)
When the splice method is called with two or more arguments start, deleteCount and (optionally) item1, item2, etc., the deleteCount elements of the array starting at array index start are replaced by the arguments item1, item2, etc. An Array object containing the deleted elements (if any) is returned.
string
toLocaleString()
The elements of the array are converted to Strings using their toLocaleString methods, and these Strings are then concatenated, separated by occurrences of a separator String that has been derived in an implementation-defined locale-specific way.
string
toString()
Array
unshift(any items...)
The arguments are prepended to the start of the array, such that their order within the array is the same as the order in which they appear in the argument list.
Referenced by
Functionapply(...)
Stringmatch(...)